package com.macro.mall.service.impl;

import com.macro.mall.dao.PmsPanicBuyingMapper;
import com.macro.mall.dto.PmsProductResult;
import com.macro.mall.mapper.PmsSkuStockMapper;
import com.macro.mall.model.PmsSkuStock;
import com.macro.mall.model.SmsFlashPromotion;
import com.macro.mall.service.PmsPanicBuyingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PmsPanicBuyingServiceImpl implements PmsPanicBuyingService {
    @Autowired
    private PmsPanicBuyingMapper pmsPanicBuyingMapper;
    @Autowired
    private PmsSkuStockMapper pmsSkuStockMapper;
    //根据商品id获取商品编辑信息 PmsProductAttribute
    @Override
    public List<PmsProductResult> getUpdateInfo(Long id) {
        List<PmsProductResult> list = pmsPanicBuyingMapper.getUpdateInfo(id);
        return list;
    }





    @Override
    public List<PmsSkuStock> getList(Long pid) {
        return pmsSkuStockMapper.getList(pid);


  }
    //判断状态是否开启
    @Override
    public SmsFlashPromotion stateid(Long pid) {
        SmsFlashPromotion stateId =  pmsPanicBuyingMapper.stateid(pid);
        return stateId;
    }


    //日期
//        Date endDate = smsFlashPromotion.getEndDate();
//        Date startDate = smsFlashPromotion.getStartDate();
//        //时间
//        Date startTime1 = smsFlashPromotion.getStartTime();
//        Date endTime1 = smsFlashPromotion.getEndTime();
//
//        // 比较时间
//        Calendar instance = Calendar.getInstance();
//        Calendar startTime = Calendar.getInstance();
//        Calendar endTime = Calendar.getInstance();
//        instance.setTime(new Date());
//        startTime.setTime(startDate);
//        startTime.setTime(endDate);
//        if (instance.after(startTime) && instance.before(endTime)) {
//            System.out.println("在区间日期之内");
//        } else {
//            System.out.println("不在区间日期之外");
}

